<?php

namespace service;

/**
 * Class InterfaceCode 接口返回code
 * @package app\common\service
 */

class InterfaceCode {

    const SUCCESS = '1000';
    const query_data_error = '1101';
    const post_data_error = '1102';
    const cipher_decrypt_error = '1103';
    const json_decode_error = '1104';
    const Invalid_tms_format = '4101';
    const Time_expired = '4102';
    const Did_must_need = '4111';
    const No_such_did = '4112';
    const Invalid_dsig = '4113';
    const Uid_must_need = '4121';
    const No_such_uid = '4122';
    const Invalid_usig = '4123';
    const Invalid_request = '4131';
    const Token_error = '5005';

    //app错误代码
    public static $app_error_code = [
        'Invalid_action' => 1001, //无效控制器
        'Invalid_operating' => 1002, //无效操作
        'Error_server' => 1003, //服务错误
        'Invalid_time' => 1004, //无效的时间段
        'No_authen' => 1005,  //无需认证
        //参数操作
        'PARAMETER_EMPTY' => 4001, //参数为空
        'PARAMETER_ERROR' => 4002, //参数有误
        //数据库操作
        'CREATE_SERVER' => 5001, //添加失败
        'DELETE_SERVER' => 5002, //删除失败
        'UPDATE_SERVER' => 5003, //修改失败
        'READ_SERVER' => 5004, //查询失败或无返回数据
        'Token_Error' => 5005, //token验证失败
        'OBJUECT_NULL' => 6000, //操作对象不能为空
        'TRIES_LIMIT' => 6001, //次数限制
        'Longin_failed' => 7001, //登录失败

    ];

    public static $message = [
        self::SUCCESS => 'Success' ,
        self::query_data_error => '数据错误',
        self::post_data_error => 'post数据错误',
        self::json_decode_error => '数据json decode错误',
        self::cipher_decrypt_error    => '数据解密错误',
        self::Invalid_tms_format => 'TMS格式无效,请重新启动应用' ,
        self::Time_expired => '时间过期,请重新启动应用' ,

        self::No_such_did => '设备注册失败，请重新启动应用' ,
        self::Invalid_dsig => '签名验证失败,请重新启动应用' ,
        self::Did_must_need => '无法识别设备,请重新启动应用' ,

        self::No_such_uid => '请登录后操作' ,
        self::Invalid_usig => '用户验证失败' ,
        self::Uid_must_need => '请重新登录' ,

        self::Invalid_request => '无法注册设备,请重新启动应用',
        self::Token_error => 'Token失效',
    ];

    //api memcache缓存
    public static $app_sns_cache_key = [
        'sns_key'=>'app_card_h5_sns_',                               //验证码手机号发送次数前缀
        'ip_key'=>'app_card_sms_ip_',                                 //IP获取短信验证码的限制前缀
        'tel_key'=>'app_card_tel_sms_',                               //记录验证码的发送时间
        'sms_verifycode_pre' => 'app_card_sms_verifycode_pre_',       //短信验证码前缀(注册)
        'sms_verifycode_login' => 'app_card_sms_verifycode_login_',   //短信验证码前缀(登录)
        'sms_verifycode_pass' => 'app_card_sms_verifycode_pass_',     //设置密码的短信验证码前缀(找回密码)
    ];
}